package org.jeecg.modules.online.cgform.converter.p010a;

import java.util.List;
import java.util.Map;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.online.cgform.converter.FieldCommentConverter;
import org.jeecg.modules.online.cgform.utils.CgformUtil;
import org.jeecg.modules.online.cgreport.util.CgReportSqlUtil;

/* renamed from: org.jeecg.modules.online.cgform.converter.a.a */
/* loaded from: hibernate-re-3.7.1-RC.jar:org/jeecg/modules/online/cgform/converter/a/a.class */
public class ConfigConvert implements FieldCommentConverter {

    /* renamed from: a */
    protected ISysBaseAPI f169a;

    /* renamed from: b */
    protected String f170b;

    /* renamed from: c */
    protected String f171c;

    /* renamed from: d */
    protected String f172d;

    /* renamed from: e */
    protected String f173e;

    public ConfigConvert() {
        this.f169a = (ISysBaseAPI) SpringContextUtils.getBean(ISysBaseAPI.class);
    }

    public ConfigConvert(String str, String str2, String str3) {
        this();
        this.f171c = str;
        this.f172d = str2;
        this.f173e = str3;
    }

    public String getField() {
        return this.f170b;
    }

    public void setField(String field) {
        this.f170b = field;
    }

    public String getTable() {
        return this.f171c;
    }

    public void setTable(String table) {
        this.f171c = table;
    }

    public String getCode() {
        return this.f172d;
    }

    public void setCode(String code) {
        this.f172d = code;
    }

    public String getText() {
        return this.f173e;
    }

    public void setText(String text) {
        this.f173e = text;
    }

    @Override // org.jeecg.modules.online.cgform.converter.FieldCommentConverter
    public String converterToVal(String txt) {
        String str;
        if (oConvertUtils.isNotEmpty(txt)) {
            String str2 = this.f173e + "= '" + txt + CgformUtil.f231C;
            int indexOf = this.f171c.indexOf("where");
            if (indexOf > 0) {
                str = this.f171c.substring(0, indexOf).trim();
                str2 = str2 + CgReportSqlUtil.f508b + this.f171c.substring(indexOf + 5);
            } else {
                str = this.f171c;
            }
            List queryFilterTableDictInfo = this.f169a.queryFilterTableDictInfo(str, this.f173e, this.f172d, str2);
            if (queryFilterTableDictInfo != null && queryFilterTableDictInfo.size() > 0) {
                return ((DictModel) queryFilterTableDictInfo.get(0)).getValue();
            }
            return null;
        }
        return null;
    }

    @Override // org.jeecg.modules.online.cgform.converter.FieldCommentConverter
    public String converterToTxt(String val) {
        String str;
        if (oConvertUtils.isNotEmpty(val)) {
            String str2 = this.f172d + "= '" + val + CgformUtil.f231C;
            int indexOf = this.f171c.indexOf("where");
            if (indexOf > 0) {
                str = this.f171c.substring(0, indexOf).trim();
                str2 = str2 + CgReportSqlUtil.f508b + this.f171c.substring(indexOf + 5);
            } else {
                str = this.f171c;
            }
            List queryFilterTableDictInfo = this.f169a.queryFilterTableDictInfo(str, this.f173e, this.f172d, str2);
            if (queryFilterTableDictInfo != null && queryFilterTableDictInfo.size() > 0) {
                return ((DictModel) queryFilterTableDictInfo.get(0)).getText();
            }
            return null;
        }
        return null;
    }

    @Override // org.jeecg.modules.online.cgform.converter.FieldCommentConverter
    public Map<String, String> getConfig() {
        return null;
    }
}
